local taxue = fk.CreateSkill {
  name = "lingling__taxue",
  tags = { Skill.Combo },
}

Fk:loadTranslationTable{
  ["lingling__taxue"] = "踏血",
  [":lingling__taxue"] = "连招技（坐骑牌＋红色基本牌），摸两张牌。",
}

taxue:addEffect(fk.CardUsing, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(taxue.name) and
      data.extra_data and data.extra_data.combo_skill and data.extra_data.combo_skill[taxue.name]
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    player:drawCards(2, taxue.name)
  end,
})

taxue:addEffect(fk.AfterCardUseDeclared, {
  can_refresh = function (self, event, target, player, data)
    return target == player and player:hasSkill(taxue.name, true) and
      data.card.color == Card.Red and data.card.type == Card.TypeBasic
  end,
  on_refresh = function (self, event, target, player, data)
    local room = player.room
    local use_events = room.logic:getEventsByRule(GameEvent.UseCard, 2, function (e)
      return e.data.from == player
    end, Player.HistoryGame)
    if #use_events == 2 and
      (use_events[2].data.card.sub_type == Card.SubtypeOffensiveRide or
      use_events[2].data.card.sub_type == Card.SubtypeDefensiveRide) then
      data.extra_data = data.extra_data or {}
      data.extra_data.combo_skill = data.extra_data.combo_skill or {}
      data.extra_data.combo_skill[taxue.name] = true
    end
  end,
})

return taxue
